class Solution {
public:
    void _hanota(vector<int>& begin, vector<int>& help, vector<int>& end, int n)
    {
        if (n == 1)
        {
            end.push_back(begin.back());
            begin.pop_back();

            return ;
        }
        _hanota(begin, end, help, n - 1);
        end.push_back(begin.back());
        begin.pop_back();
        _hanota(help, begin, end, n - 1);
    }

    void hanota(vector<int>& A, vector<int>& B, vector<int>& C) {
        _hanota(A, B, C, A.size());
    }   
};